<template>
  <view class="search-box">
    <slot name="leftSlot" v-if="leftSlot"></slot>
		<u-search 
      shape="round" 
      :showAction="false"
      :placeholder="placeholder" 
      @focus="searchFocus" 
      :pageTitle="pageTitle" 
      :bgColor="bgColor"></u-search>
  </view>
</template>

<script>
	export default {
		name: 'Search',
		props: {
			pageTitle: {
				type: String,
				default: '搜索页面的导航'
			},
			placeholder: {
				type: String,
				default: '请输入'
			},
			storageName: {
				type: String,
				default: 'searchStorage'
			},
			showHistoryBox: {
				type: Boolean,
				default: true
			},
			backColor:{
				type:String,
				default:'#fff'
			},
			bgColor:{
				type:String,
				default:'#fff'
			},
      leftSlot:  {
				type: Boolean,
				default: false
			},
		},
		data() {
			return {
				
			}
		},

		created() {
			
		},

		methods: {
			searchFocus() {
				// const urlParams = {
				// 	title: this.pageTitle,
				// 	placeholder: this.placeholder,
				// 	storageName: this.storageName,
				// 	showHistoryBox: this.showHistoryBox
				// }
				// const params = encodeURIComponent(JSON.stringify(urlParams))
				// const path = `/subPages/componentPages/searchPage?params=${params}`
				// uni.navigateTo({
				// 	url: path
				// })
			}
		}
	}
</script>
<style lang="scss" scoped>
	.search-box {
		padding: 30rpx 35rpx;
		// height: 120rpx;
		// line-height: 100rpx;
    background-color: rgba(194, 126, 21, 1);
    display: flex;
	}
</style>